package org.bocs.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.bocs.service.UserService;
import org.bocs.untils.ResultVo;
import org.springframework.web.bind.annotation.*;

@RestController
@Tag(name = "/user", description = "用户登录")
@RequestMapping("/user")
@CrossOrigin
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/login")
    @Operation(summary = "用户登录接口")
    public ResultVo userLogin(@RequestParam("username") String userName, @RequestParam("password") String password){
        return userService.userLogin(userName, password);
    }

    @PostMapping("/register")
    @Operation(summary = "用户注册接口")
    public ResultVo userRegister(@RequestParam("username") String userName, @RequestParam("password") String password) {
        return userService.userRegister(userName, password);
    }
}
